/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2021-2021. All rights reserved.
 */

package com.device.idea.demo.core;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.device.idea.demo.R;

import java.util.List;

/**
 * PenPickerAdapter
 *
 * @since 2021-01-26
 */
public class PenPickerAdapter extends CommonAdapter<PenChildMenu> {
    public PenPickerAdapter(Context context, List<PenChildMenu> list, int layoutId) {
        super(context, list, layoutId);
    }

    @Override
    public void convert(CommonViewHolder holder, PenChildMenu item, int position) {
        View view = holder.getView(R.id.item_pop_color_picker_iv);
        View rootView = holder.getView(R.id.item_pop_color_picker_ll);
        if (view instanceof ImageView) {
            ImageView imageView = (ImageView) view;
            imageView.setImageResource(item.getImageResId());
            rootView.setSelected(item.isSelected());
        }
    }
}
